<?php

namespace App\Models;

class AssetModel extends RbhBaseModel
{
    protected $table = 'assets';

    protected $guarded = [];

    /**
     * 获取模型
     * @param $request
     * @return mixed
     */
    public static function getModel($request): mixed
    {
        $Model = self::where('id', '>', 0);
        if ($request->input('type'))
            $Model = $Model->where('type', $request->input('type'));
        if ($request->input('group_id'))
            $Model = $Model->where('group_id', $request->input('group_id'));
        if ($request->input('filename'))
            $Model = $Model->where('filename', 'like', '%' . $request->input('filename') . '%');
        return $Model;
    }
}
